3.33 \(\int \cos ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x)) \, dx\)

Optimal. Leaf size=44 \[ -\frac {a \sin ^3(c+d x)}{3 d}+\frac {a \sin (c+d x)}{d}-\frac {b \cos ^3(c+d x)}{3 d} \]

[Out]

-1/3*b*cos(d*x+c)^3/d+a*sin(d*x+c)/d-1/3*a*sin(d*x+c)^3/d

________________________________________________________________________________________

Rubi [A]  time = 0.06, antiderivative size = 44, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 4, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3090, 2633, 2565, 30} \[ -\frac {a \sin ^3(c+d x)}{3 d}+\frac {a \sin (c+d x)}{d}-\frac {b \cos ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x]),x]

[Out]

-(b*Cos[c + d*x]^3)/(3*d) + (a*Sin[c + d*x])/d - (a*Sin[c + d*x]^3)/(3*d)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2565

Int[(cos[(e_.) + (f_.)*(x_)]*(a_.))^(m_.)*sin[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> -Dist[(a*f)^(-1), Subst[
Int[x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Cos[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2]
 &&  !(IntegerQ[(m - 1)/2] && GtQ[m, 0] && LeQ[m, n])

Rule 2633

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rule 3090

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[cos[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rubi steps

\begin {align*} \int \cos ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x)) \, dx &=\int \left (a \cos ^3(c+d x)+b \cos ^2(c+d x) \sin (c+d x)\right ) \, dx\\ &=a \int \cos ^3(c+d x) \, dx+b \int \cos ^2(c+d x) \sin (c+d x) \, dx\\ &=-\frac {a \operatorname {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{d}-\frac {b \operatorname {Subst}\left (\int x^2 \, dx,x,\cos (c+d x)\right )}{d}\\ &=-\frac {b \cos ^3(c+d x)}{3 d}+\frac {a \sin (c+d x)}{d}-\frac {a \sin ^3(c+d x)}{3 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.01, size = 44, normalized size = 1.00 \[ -\frac {a \sin ^3(c+d x)}{3 d}+\frac {a \sin (c+d x)}{d}-\frac {b \cos ^3(c+d x)}{3 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a*Cos[c + d*x] + b*Sin[c + d*x]),x]

[Out]

-1/3*(b*Cos[c + d*x]^3)/d + (a*Sin[c + d*x])/d - (a*Sin[c + d*x]^3)/(3*d)

________________________________________________________________________________________

fricas [A]  time = 0.75, size = 38, normalized size = 0.86 \[ -\frac {b \cos \left (d x + c\right )^{3} - {\left (a \cos \left (d x + c\right )^{2} + 2 \, a\right )} \sin \left (d x + c\right )}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

-1/3*(b*cos(d*x + c)^3 - (a*cos(d*x + c)^2 + 2*a)*sin(d*x + c))/d

________________________________________________________________________________________

giac [A]  time = 3.94, size = 55, normalized size = 1.25 \[ -\frac {b \cos \left (3 \, d x + 3 \, c\right )}{12 \, d} - \frac {b \cos \left (d x + c\right )}{4 \, d} + \frac {a \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {3 \, a \sin \left (d x + c\right )}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/12*b*cos(3*d*x + 3*c)/d - 1/4*b*cos(d*x + c)/d + 1/12*a*sin(3*d*x + 3*c)/d + 3/4*a*sin(d*x + c)/d

________________________________________________________________________________________

maple [A]  time = 1.03, size = 36, normalized size = 0.82 \[ \frac {\frac {a \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}-\frac {b \left (\cos ^{3}\left (d x +c \right )\right )}{3}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c)),x)

[Out]

1/d*(1/3*a*(2+cos(d*x+c)^2)*sin(d*x+c)-1/3*b*cos(d*x+c)^3)

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 35, normalized size = 0.80 \[ -\frac {b \cos \left (d x + c\right )^{3} + {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} a}{3 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a*cos(d*x+c)+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/3*(b*cos(d*x + c)^3 + (sin(d*x + c)^3 - 3*sin(d*x + c))*a)/d

________________________________________________________________________________________

mupad [B]  time = 0.44, size = 47, normalized size = 1.07 \[ \frac {2\,a\,\sin \left (c+d\,x\right )}{3\,d}-\frac {b\,{\cos \left (c+d\,x\right )}^3}{3\,d}+\frac {a\,{\cos \left (c+d\,x\right )}^2\,\sin \left (c+d\,x\right )}{3\,d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a*cos(c + d*x) + b*sin(c + d*x)),x)

[Out]

(2*a*sin(c + d*x))/(3*d) - (b*cos(c + d*x)^3)/(3*d) + (a*cos(c + d*x)^2*sin(c + d*x))/(3*d)

________________________________________________________________________________________

sympy [A]  time = 0.43, size = 63, normalized size = 1.43 \[ \begin {cases} \frac {2 a \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {a \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} - \frac {b \cos ^{3}{\left (c + d x \right )}}{3 d} & \text {for}\: d \neq 0 \\x \left (a \cos {\relax (c )} + b \sin {\relax (c )}\right ) \cos ^{2}{\relax (c )} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a*cos(d*x+c)+b*sin(d*x+c)),x)

[Out]

Piecewise((2*a*sin(c + d*x)**3/(3*d) + a*sin(c + d*x)*cos(c + d*x)**2/d - b*cos(c + d*x)**3/(3*d), Ne(d, 0)),
(x*(a*cos(c) + b*sin(c))*cos(c)**2, True))

________________________________________________________________________________________